package com.qingcheng.service.impl;


import com.alibaba.dubbo.config.annotation.Service;
import com.qingcheng.dao.CommentMapper;
import com.qingcheng.pojo.comment.Comment;
import com.qingcheng.service.comment.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = CommentService.class)
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;


    /**
     * 评论屏蔽
     * @param commentId 评论id
     * @param isShield 是否屏蔽
     */
    @Override
    @Transactional
    public void isShield(Integer commentId, Integer isShield) {
        Comment comment = commentMapper.selectByPrimaryKey(commentId);
        comment.setIsShield(isShield);
        commentMapper.updateByPrimaryKey(comment);
    }

    public Comment findById(Integer id) {
        return commentMapper.selectByPrimaryKey(id);
    }
}
